package com.blog.admin.service;

import com.blog.admin.mapper.BlogClassifyMapper;
import com.blog.admin.vo.BlogClassifyVO;
import com.blog.vo.PageVO;
import com.blog.common.PageHelperLog;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author tangqj
 * @Description 友情链接
 * @create 2020/2/18 14:35
 */
@Service
@Transactional
public class BlogClassifyService {
    @Autowired
    BlogClassifyMapper blogClassifyMapper;

    /**
     * 分页获取分类
     * @param page
     * @return
     */
    @PageHelperLog(desc = "msg")
    public PageInfo<BlogClassifyVO> getBlogClassify(PageVO page,BlogClassifyVO blogClassifyVO) {
        List<BlogClassifyVO> list = blogClassifyMapper.getBlogClassify(blogClassifyVO);
        PageInfo<BlogClassifyVO> pageRest = new PageInfo<BlogClassifyVO>(list);
        return pageRest;
    }

    /**
     * 插入分类
     * @param blogClassifyVO
     * @return
     */
    public boolean insertBlogClassify(BlogClassifyVO blogClassifyVO) {
        int result = blogClassifyMapper.insertBlogClassify(blogClassifyVO);
        return result>0?true:false;
    }

    /**
     * 修改分类
     * @param blogClassifyVO
     * @return
     */
    public boolean updateBlogClassify(BlogClassifyVO blogClassifyVO) {
        int result = blogClassifyMapper.updateBlogClassify(blogClassifyVO);
        return result>0?true:false;
    }

    /**
     * 删除分类
     * @param id
     * @return
     */
    public boolean deleteBlogClassifyById(String id) {
        int result = blogClassifyMapper.deleteBlogClassifyById(id);
        return result>0?true:false;
    }


}
